
import axios from "axios"


const instance = axios.create({
  baseURL: "https://www.fastmock.site/mock/f16046753ffbf0e8b0bbc8d73e5fbd52/doctor",
  timeout: 5000

})



instance.interceptors.request.use(function (config) {

  return config;
}, function (error) {

  return Promise.reject(error);
});



instance.interceptors.response.use(function (response) {

  return response;
}, function (error) {

  return Promise.reject(error);
});


const request = (payload={}) => {

  return instance.request({
    ...payload
  }).then(res => res.data).catch(err => err)
}

export { request, instance, }